package com.example.controller;


import com.example.pojo.ResultBean;
import com.example.pojo.SysDict;
import com.example.service.ISysDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 字典表 前端控制器
 * </p>
 *
 * @author lyj
 * @since 2023-02-20
 */
@RestController
@RequestMapping("/sys-dict")
public class SysDictController {

    @Autowired
    private ISysDictService dictService;

    /**
     * 根据字典类型查询
     * @param type
     * @return
     */
    @GetMapping("queryByType/{type}")
    public ResultBean queryByType(@PathVariable("type") String type){
        List<SysDict> list = dictService.lambdaQuery().eq(SysDict::getType,type).list();
        return ResultBean.success(list);
    }
}
